package com.mooral.dataAccess;

import java.sql.Connection;
import java.sql.SQLException;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.sql.DataSource;


public class DataSourceManager{

    private DataSource dataSource = null;

    public DataSourceManager(String icLoockup, String dataSourceName, String user, String pwd) throws Exception {

		Context initContext = new InitialContext();
		Context envContext = (Context) initContext.lookup(icLoockup);
		
		dataSource = (DataSource) envContext.lookup(dataSourceName);
    }

    public Connection getConnection() throws SQLException {
		return dataSource.getConnection();
    }
}
